package com.fanco.learn_datastruct_leetcode.designpattern.facade;

/**
 * @author qiaowang 2022/2/15
 * 描述
 */
public class HomeTheaterFacade {

    // 定义各个子系统的对象
    private Screen screen;
    private Popcorn popcorn;
    private DvdPlayer dvdPlayer;
    private Projector projector;

    public HomeTheaterFacade() {
        this.screen = Screen.getInstance();
        this.popcorn = Popcorn.getInstance();
        this.dvdPlayer = DvdPlayer.getInstance();
        this.projector = Projector.getInstance();
    }

    public void ready() {
        popcorn.on();
        popcorn.pop();
        screen.down();
        projector.on();
        dvdPlayer.on();
    }

    public void play() {
        dvdPlayer.play();
    }

    public void pause() {
        dvdPlayer.pause();
    }

    public void end() {
        popcorn.off();
        screen.up();
        projector.off();
        dvdPlayer.off();
    }
}
